// *****************************************************************************
// Filename:    subset-enumeration.cc
// Date:        2012-07-04 09:55
// Author:      Guangda Lai
// Email:       lambda2fei@gmail.com
// Description: TODO(laigd): Put the file description here.
// *****************************************************************************

#include "subset-enumeration.h"

#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <fstream>
#include <iostream>
#include <map>
#include <set>
#include <string>
#include <vector>

using std::cerr;
using std::cin;
using std::cout;
using std::endl;
using std::ifstream;
using std::map;
using std::ofstream;
using std::set;
using std::string;
using std::vector;

class IntHandler {
 public:
  void operator()(const vector<int> &subset) const {
    for (int i = 0; i < subset.size(); ++i) {
      cout << subset[i] << ", ";
    }
    cout << endl;
  }
};

void Test() {
  IntHandler handler;
  vector<int> ivet;
  for (int i = 1; i <= 10; ++i) {
    ivet.push_back(i);
  }
  cout << "Testing k = 0:" << endl;
  ForEachSubset(ivet, 0, &handler);
  cout << endl;

  cout << "Testing k = 1:" << endl;
  ForEachSubset(ivet, 1, &handler);
  cout << endl;

  cout << "Testing k = 2:" << endl;
  ForEachSubset(ivet, 2, &handler);
  cout << endl;

  cout << "Testing k = 10:" << endl;
  ForEachSubset(ivet, 10, &handler);
  cout << endl;

  cout << "Testing k = 11:" << endl;
  ForEachSubset(ivet, 11, &handler);
  cout << endl;
}

int main(int argc, char **argv) {
  Test();
  return 0;
}
